
package com.sgcc.system.api.factory;

import com.sgcc.common.core.domain.R;
import com.sgcc.common.core.web.domain.AjaxResult;
import com.sgcc.system.api.RemoteOMonTarService;
import com.sgcc.system.api.domain.OMonTar;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 文件服务降级处理
 *
 * @author sgcc
 */
@Component
public class RemoteOMonTarFallbackFactory implements FallbackFactory<RemoteOMonTarService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteOMonTarFallbackFactory.class);

    @Override
    public RemoteOMonTarService create(Throwable throwable)
    {
        log.error("失败:{}", throwable.getMessage());
        return new RemoteOMonTarService()
        {
            @Override
            public R<OMonTar> findCode(String code) {
            	System.out.println(code);
                return R.fail("服务重启中，请稍后在试~");
            }

			@Override
			public AjaxResult editStatus(String monTarCode, String monStatus) {
				// TODO Auto-generated method stub
				return AjaxResult.error("服务重启中，请稍后在试~");
			}

            @Override
            public AjaxResult updateStatus() {
                return AjaxResult.error("服务重启中，请稍后在试~");
            }


        };
    }
}
